<%-- 
    Document   : Profissao
    Created on : May 29, 2011, 12:40:19 AM
    Author     : diogo
--%>

<%@page import="org.apache.taglibs.standard.lang.jstl.Coercions"%>
<%@page import="java.sql.ResultSetMetaData"%>
<%@page import="BancoDados.Relatorio"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="BancoDados.Profissao"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>


<%


String sNomeRelatorio = request.getParameter("nomerelatorio");
sNomeRelatorio = (sNomeRelatorio == null ? "0" : sNomeRelatorio);

//System.out.println("q q veio na b " + sNomeRelatorio);
int numeroRelatorio = Integer.parseInt(sNomeRelatorio);
//System.out.println(">>>>>> FILTRANDO AREA" + sNomeRelatorio);

ResultSet rs = Relatorio.GeraRelatorio(numeroRelatorio);
ResultSetMetaData rsmd = rs.getMetaData();
int iColumnAmount = rsmd.getColumnCount();
%>


<%@include file="../staticHtml/table.html" %>

<%

// NOME DAS COLUNA
	iColumnAmount = rsmd.getColumnCount();
	for (int x = 0; x < iColumnAmount; x++) {
%>
<%@include file="../staticHtml/td.html" %><b><%= rsmd.getColumnName(x + 1)%></b></td>

<%}%>
</tr>

<% while (rs.next()) { %>
		<%@include file="../staticHtml/tr.html" %>
<%
		for (int x = 0; x < iColumnAmount; x++) {
			String result = rs.getObject(x + 1).toString();
%>
			<%@include file="../staticHtml/td2.html" %> <%= result%> </td>
		<%}%>
</tr>

<%}%>

</table>

